package design.patterns.creational.simplefactory;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/3/29 9:20
 */
public class ComputerFactory2 {

    public static Computer createComputer(String className){
        Computer computer = null;

        try {
            computer = (Computer) Class.forName(className).newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
        return computer;
    }
   

}
